#ifndef SINGLEAPPLICATION_H
#define SINGLEAPPLICATION_H

#include <QObject>
#include <QApplication>
#include <QtNetwork/QLocalServer>
#include <QWidget>

class C_SingleApplication : public QApplication
{
    Q_OBJECT

public:
    C_SingleApplication(int &argc, char **argv);
    ~C_SingleApplication();

    bool IsRunning();
    void SetWidget(QWidget* widget);

signals:
    void newLocalConnection();

private slots:
    void NewLocalConnection();

private:
    void InitLocalConnection();
    void NewLocalServer();

private:
    bool m_bRunning;
    QWidget* m_widget;
    QLocalServer* m_localServer;
    QString m_strServerName;
};

#endif // SINGLEAPPLICATION_H
